infosys1-4.ipynb
- Milestone1
- importing netflix movie and tv shows dataset from kaggle
- Milestone2
- File
- Edit
- View
- Run
- Kernel
- Settings
- Help
Kernel status: Idle
# Milestone1
Milestone1¶
# importing netflix movie and tv shows dataset from kaggle
import pandas as pd
df=pd.read_csv(r"C:\Users\saiga\Downloads\netflix_titles.csv\netflix_titles.csv")
df.head()
df.info()
[146]:
Selection deleted
#checking missing values
df.isnull().sum()
[146]:
show_id 0 type 0 title 0 director 2634 cast 825 country 831 date_added 10 release_year 0 rating 4 duration 3 listed_in 0 description 0 dtype: int64
[174]:
# Handling Missing values
df['country'].fillna('Unknown', inplace=True)
df['rating'].fillna(df['rating'].mode()[0], inplace=True)
df['director'].fillna('Unknown',inplace=True)
df['cast'].fillna('Unknown',inplace=True)
df['duration'].fillna(df['duration'].mode()[0], inplace=True)
df['date_added'].fillna('not specified',inplace=True)
df.isnull().sum()
C:\Users\saiga\AppData\Local\Temp\ipykernel_26280\2888745227.py:2: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.
The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.
For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.
df['country'].fillna('Unknown', inplace=True)
C:\Users\saiga\AppData\Local\Temp\ipykernel_26280\2888745227.py:3: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.
The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.
For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.
df['rating'].fillna(df['rating'].mode()[0], inplace=True)
C:\Users\saiga\AppData\Local\Temp\ipykernel_26280\2888745227.py:4: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.
The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.
For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.
df['director'].fillna('Unknown',inplace=True)
C:\Users\saiga\AppData\Local\Temp\ipykernel_26280\2888745227.py:5: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.
The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.
For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.
df['cast'].fillna('Unknown',inplace=True)
C:\Users\saiga\AppData\Local\Temp\ipykernel_26280\2888745227.py:6: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.
The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.
For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.
df['duration'].fillna(df['duration'].mode()[0], inplace=True)
C:\Users\saiga\AppData\Local\Temp\ipykernel_26280\2888745227.py:7: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.
The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.
For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.
df['date_added'].fillna('not specified',inplace=True)
[174]:
show_id 0 type 0 title 0 director 0 cast 0 country 0 date_added 0 release_year 0 rating 0 duration 0 listed_in 0 description 0 dtype: int64
[170]:
0
[238]:
<Axes: xlabel='type'>
[260]:
<Axes: ylabel='count'>
[270]:
# visaulize the distribution of rating
df['rating'].value_counts().plot(kind='line')
[270]:
<Axes: xlabel='rating'>
[302]:
country United States 3211 India 1008 Unknown 831 United Kingdom 628 Canada 271 Japan 259 France 212 South Korea 211 Spain 181 Mexico 134 Name: count, dtype: int64
Notebook cell shifted up successfully
Common Tools
No metadata.
Advanced Tools
No metadata.
Anaconda Assistant
AI-powered coding, insights and debugging in your notebooks.
To enable the following extensions, create an account or sign in.
- Anaconda Assistant4.1.0
- Coming soon!
- Data Catalogs
- Panel Deployments
- Sharing
Already have an account? Sign In
For more information, read our Anaconda Assistant documentation.
![Python [conda env:base] *](./infosys1-4_files/logo-64x64.png)